//根据action 改变state 的规则都在reducer里
import * as lights from '../constants/TrafficLight';

const initState={
    color:'red',
    time:7
};


export default function light(state=initState,action) {
    switch (action.type){
        case lights.CHANGE_GREEN:
            return {
                color:'green',
                time:'5'
            };
        case lights.CHANGE_YELLOW:
            return {
                color:'yellow',
                time:'3'
            };
        case lights.CHANGE_RED:
            return Object.assign({},initState);

        default:
            return state;

    }
}